import { getAllDept } from '@/api/system/dept'

const dept = {
  state: {
    listdept: []
  },

  mutations: {
    SET_LISTDEPT: (state, list) => {
      state.listdept = list
    }
  },

  actions: {
    // 获取部门归属信息
    GetAllDeptInfo({ commit, state }) {
      return new Promise((resolve, reject) => {
        getAllDept().then(res => {
          const list = res.data;      
          commit('SET_LISTDEPT', list)
          resolve(res)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default dept
